<?php 
class ajaxAction extends sfAction{
	public function execute($request){
		$act = $request->getParameter('act_ext', '');
		$rt = array();
		switch ($act) {
			case Branches::AJAX_PROVINCE:
				$id = $request->getParameter('dtArea', 0);
				$rt = LocationProvinces::getListByAreaId(intval($id));
				break;
			case Branches::AJAX_DISTRICT:
				$id = $request->getParameter('dtProvince', 0);
				$rt = LocationDistricts::getListByProvinceId(intval($id));
				break;
			case Branches::AJAX_BRANCH:
				$data['area_id'] = $request->getParameter('area_id', -1);
				$data['province_id'] = $request->getParameter('province_id', -1);
				$data['district_id'] = $request->getParameter('district_id', -1);
				
				$rt = Branches::getListForDisplay($data);
				break;
		}
		print_r(json_encode($rt));
		return sfView::NONE;
		
	}
}